<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Class Status Update</title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>
			
			<p:panel header="Class Status Update" style="min-height: 550px" styleClass="prime_panel">

				<p:growl id="growl" showDetail="true" sticky="false" autoUpdate="true"  showSummary="false" />
				
				<center>
					<h:form id="form">
						<p:dataTable style="width: 100%" id="classes" var="clas"
							value="#{classStatusUpdateBean.classModel}" paginator="true"
							rows="10" paginatorPosition="bottom"
							selection="#{classStatusUpdateBean.selectedClassesList}">

							<p:column selectionMode="multiple" style="width:18px" />

							<p:column headerText="Class Title" filterBy="#{clas.classTitle}"
									style="width:50%">
					            #{clas.classTitle}  
					        </p:column>
	
								<p:column headerText="Short Name" filterBy="#{clas.shortName}"
									style="width:25%">
					            #{clas.shortName}  
					        </p:column>
	
							<p:column id="status" headerText="Status" style="width:25%">   
					            	#{clas.currentStatus eq true ? "Offered" : "Not Offered"}
					        </p:column>

							<f:facet name="footer">
								<p:commandButton id="multiViewButton" value="Change Status"
									update=":form:displayMulti"
									oncomplete="multiClassDialog.show()" />
							</f:facet>
						</p:dataTable>

						<p:dialog id="multiDialog" header="Selected Courses"
									widgetVar="multiClassDialog" showEffect="fade"
									hideEffect="explode">

							<p:dataList id="displayMulti"
										value="#{classStatusUpdateBean.selectedClassesList}"
										var="selectedClass">
						            #{selectedClass.classTitle} - #{selectedClass.currentStatus eq true ? "Offered" : "Not Offered"}
					        </p:dataList>
	
							<table>
								<tr>
									<td><h:outputLabel>Change status to:</h:outputLabel>
									</td>
									<td><p:selectOneRadio id="options"
											value="#{classStatusUpdateBean.newStatus}">
											<f:selectItem itemLabel="Offered" itemValue="true" />
											<br />
											<f:selectItem itemLabel="Not Offered" itemValue="false" />
										</p:selectOneRadio></td>
								</tr>
							</table>
							<p:commandButton id="submit" value="Update" type="submit"
								ajax="false" action="#{classStatusUpdateBean.perform}" />
	
						</p:dialog>
					</h:form>
				</center>
				
			</p:panel>
					</center>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
			